<?php

	// TITLE: Account_recovery_log AUTO MODEL
	// FILE: scaffolding/model/account_recovery_log.php
	// AUTHOR: AUTOGEN
	// CREATED: 2015/04/20 07:49:57
	// DESCRIPTION: 
	// REQUIREMENTS: 

	$createAccountRecoveryLog = function($con, $accountRecoveryLog) {
		$sql = 'INSERT INTO account_recovery_log (account_id, date) VALUES (';
		$sql .= $account_recovery_log->getAccountId() . ', ';
		$sql .= $account_recovery_log->getDate() . ')';
		$sql .= ')';
		$result = mysqli_query($con, $sql);
		$id = ($result) ? mysqli_insert_id($con) : $result;
		mysqli_close($con);
		return $id;
	};

	$readAccountRecoveryLog = function($con, $id) {
		$sql = 'SELECT * FROM account_recovery_log WHERE id = ' . $id;
		$results = mysqli_query($con, $sql);
		mysqli_close($con);
		if ($results) {
			$result = mysqli_fetch_array($results);
			$accountRecoveryLog = new AccountRecoveryLog();
			$accountRecoveryLog->setAccountId($dbio->select($readAccount(result[0])));
			$accountRecoveryLog->setDate(result[1]);
		} else {
			$accountRecoveryLog = false;
		}
		return $accountRecoveryLog;
	};

	$updateAccountRecoveryLog = function($con, $accountRecoveryLog) {
		$sql = 'UPDATE account_recovery_log SET ';
		$sql .= 'account_id = ' . $account_recovery_log->getAccountId() . ', ';
		$sql .= 'date = ' . $account_recovery_log->getDate() ;
		$sql .= 'WHERE id = ' . id;
		$result = mysqli_query($con, $sql);
		mysqli_close($con);
		return $result;
	};

	$deleteAccountRecoveryLog = function($con, $id) {
		$sql = 'DELETE FROM account_recovery_log WHERE account_id = ' . $id;
		$result = mysqli_query($con, $sql);
		mysqli_close($con);
		return $result;
	};

	$listAccountRecoveryLog = function($con) {
		$sql = 'SELECT * FROM account_recovery_log';
		$results = mysqli_query($con, $sql);
		mysqli_close($con);
		if ($results) {
			$accountRecoveryLogs = array();
			while ($result = mysqli_fetch_array($results)) {
				$accountRecoveryLog = new AccountRecoveryLog();
				$accountRecoveryLog->setAccountId($dbio->select($readAccount(result[0])));
				$accountRecoveryLog->setDate(result[1]);
				$accountRecoveryLogs[] = accountRecoveryLog;
			}// end while
		} else {
			$accountRecoveryLogs = false;
		}
		return $accountRecoveryLogs;
	};

